#include "StdAfx.h"
#include "FishTrackerApp.hxx"
#include "PipeLine.hxx"
#include "TrackerModel.hxx"
#include "TrackerView.hxx"


FishTrackerApp::FishTrackerApp(void)
{
	_pipeLine = 0;

	_trackerModel = 0;
	_trackerView = 0;
}


FishTrackerApp::~FishTrackerApp(void)
{
	if( _pipeLine ) 
	{
		delete _pipeLine;
		_pipeLine = 0;
	}

	if( _trackerModel )
	{
		delete _trackerModel;
		_trackerModel = 0;
	}

	if( _trackerView )
	{
		delete _trackerView;
		_trackerView = 0;
	}
}

void FishTrackerApp::initialize()
{
	_pipeLine = new PipeLine();
	_pipeLine->initialize();
	
	_trackerModel = new TrackerModel();
	_trackerModel->initialize();
	
	_trackerView = new TrackerView();
	_trackerView->initialize();

	_trackerModel->setView( _trackerView );
	_trackerView->setModel( _trackerModel );
	
	_trackerView->setSubViewModels();
	_trackerModel->setSubModelViews();	

	_pipeLine->setTrackerModel( _trackerModel );

	//_trackerView->initializeSubViews();
}

void FishTrackerApp::start()
{
	_pipeLine->start();
}

void FishTrackerApp::render()
{
	if( _trackerView )
		_trackerView->render();
}